// 场次选择功能
document.addEventListener('DOMContentLoaded', function() {
    const showTimes = document.querySelectorAll('.show-time');
    if (showTimes.length > 0) {
        showTimes.forEach(show => {
            show.addEventListener('click', function() {
                // 移除其他场次的选择状态
                showTimes.forEach(s => s.classList.remove('selected'));
                // 添加当前场次的选择状态
                this.classList.add('selected');
            });
        });
    }
    
    // 支付方式切换
    const paymentMethod = document.getElementById('payment_method');
    const cardFields = document.getElementById('card-fields');
    
    if (paymentMethod) {
        paymentMethod.addEventListener('change', function() {
            if (this.value === 'card') {
                cardFields.style.display = 'block';
            } else {
                cardFields.style.display = 'none';
            }
        });
        
        // 初始化显示状态
        if (paymentMethod.value !== 'card') {
            cardFields.style.display = 'none';
        }
    }
});